<template>
  <div class="order_list">
    <div class="common_form_search">
      <el-form ref="searchForm" :inline="true" :model="searchForm" @keyup.enter.native="search()" >
        <div>
          <el-form-item label="订单号">
            <el-input
                v-model="searchForm.orderNo"
                style="width: 220px"
                placeholder="请输入订单号"
                clearable
            />
          </el-form-item>
          <el-form-item label="商品名称">
            <el-input
                v-model="searchForm.goodsName"
                placeholder="请输入商品名称"
                clearable
            />
          </el-form-item>
          <el-form-item label="用户名">
            <el-input
                v-model="searchForm.receivingName"
                placeholder="请输入用户名"
                clearable
            />
          </el-form-item>
          <el-form-item label="手机号">
            <el-input
                v-model="searchForm.receivingMobile"
                placeholder="请输入手机号"
                clearable
            />
          </el-form-item>
          <el-form-item label="风控姓名">
            <el-input
                v-model="searchForm.riskName"
                placeholder="请输入风控姓名"
                clearable
            />
          </el-form-item>
        </div>

        <div>
          <el-form-item label="风控手机号">
            <el-input
                v-model="searchForm.riskMobile"
                placeholder="请输入风控手机号"
                clearable
            />
          </el-form-item>
          <el-form-item label="状态">
            <el-select
                v-model="searchForm.orderStatus"
                placeholder="全部"
                clearable
            >
              <el-option
                  v-for="item in selectList"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="创建时间">
            <my-date-picker ref="myDatePicker" />
          </el-form-item>
<!--          <el-form-item label="供应商">-->
<!--            <el-input-->
<!--                v-model="searchForm.shopName"-->
<!--                placeholder="请输入供应商"-->
<!--                clearable-->
<!--            />-->
<!--            &lt;!&ndash;          <el-select&ndash;&gt;-->
<!--            &lt;!&ndash;              v-model="searchForm1.memberId"&ndash;&gt;-->
<!--            &lt;!&ndash;              placeholder="请选择"&ndash;&gt;-->
<!--            &lt;!&ndash;              clearable&ndash;&gt;-->
<!--            &lt;!&ndash;              @change="changeMemberList()"&ndash;&gt;-->
<!--            &lt;!&ndash;          >&ndash;&gt;-->
<!--            &lt;!&ndash;            <el-option&ndash;&gt;-->
<!--            &lt;!&ndash;                v-for="item in memberList"&ndash;&gt;-->
<!--            &lt;!&ndash;                :key="item.member_id"&ndash;&gt;-->
<!--            &lt;!&ndash;                :label="item.shopname"&ndash;&gt;-->
<!--            &lt;!&ndash;                :value="item.member_id"&ndash;&gt;-->
<!--            &lt;!&ndash;            />&ndash;&gt;-->
<!--            &lt;!&ndash;          </el-select>&ndash;&gt;-->
<!--          </el-form-item>-->
          <el-form-item>
            <el-button
                size="small"
                type="primary"
                @click="search()"
            >查询</el-button>
            <el-button size="small" @click="reset()">重置</el-button>
            <el-button
                v-if="$hasMethod('#export1')"
                size="small"
                type="warning"
                @click="exportFile1()"
            >导出</el-button>
          </el-form-item>
        </div>

<!--        <el-form-item label="推广员id">-->
<!--          <el-input-->
<!--            v-model="searchForm.promoter_id"-->
<!--            placeholder="请输入推广员id"-->
<!--            clearable-->
<!--          />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="商品类型">-->
<!--          <el-select-->
<!--              v-model="searchForm.shoptypes"-->
<!--              placeholder="全部"-->
<!--              clearable-->
<!--              style="width: 90px"-->
<!--          >-->
<!--            <el-option-->
<!--                v-for="item in selectType"-->
<!--                :key="item.id"-->
<!--                :label="item.name"-->
<!--                :value="item.id"-->
<!--            />-->
<!--          </el-select>-->
<!--        </el-form-item>-->

      </el-form>
    </div>
    <el-divider />
    <div class="child_page">
      <el-tabs
        v-model="activeName"
        class="flex-1 nav_tabs"
        @tab-click="handleClick"
      >

<!--        <el-tab-pane-->
<!--          v-for="item in tabList"-->
<!--          :key="item.id"-->
<!--          :label="`${item.name}(${item.count})`"-->
<!--          :name="item.id"-->
<!--        />-->
<!--          <span slot="label"><i class="el-icon-date"></i>{{item.name}}323424</span>-->

<!--      </el-tabs>-->


        <el-tab-pane
            v-for="item in tabList"
            :key="item.id"
            :name="item.id"
        >
<!--          <template v-if="item.id=='deliveredNot'">-->
<!--            <span slot="label">{{item.name}}({{item.count}})-->
<!--              <el-tooltip class="item" effect="dark"  placement="right">-->
<!--                  <div slot="content" v-for="item_1 in memberCountList" :key="item_1.seller_id"  :name="item_1.name"  style="font-size: 18px;line-height: 23px">-->

<!--                    {{item_1.name}}:  {{item_1.count}} &nbsp;&nbsp;&nbsp;<br/>-->

<!--                  </div>-->
<!--               <i class="el-icon-chat-line-square" style="font-size: 19px"></i>-->
<!--              </el-tooltip>-->
<!--            </span>-->
<!--          </template>-->
<!--          <template v-else>-->
            <span slot="label">{{item.name}}({{item.count}})</span>
<!--          </template>-->
        </el-tab-pane>
      </el-tabs>
      <div class="list_wrap">
        <div class="flex list_header">
          <p style="width: 27%; padding-left: 20px">商品信息</p>
          <p class="text-center" style="width: 3%">数量</p>
          <p class="text-center" style="width: 10%">租金</p>
          <p class="text-center" style="width: 9%">租期</p>
          <p class="text-center" style="width: 8%">押金</p>
          <p class="text-center" style="width: 15%">实付金额</p>
          <p class="text-center" style="width: 5%">是否买断</p>
          <p class="text-center" style="width: 7%">下期付款金额</p>
          <p style="width: 16%; padding-left: 20px">收货人信息</p>
        </div>
        <div v-for="item in tableData" :key="item.id" class="list_item">
          <div class="flex justify-between align-center item_header">
            <el-tag :type="getOrderStatusType(item.status)">{{
              item.statusName
            }}</el-tag>
            <div class="flex-1 flex align-center">
              <p>ID：{{ item.id }}</p>
              <p>创建时间：{{ item.create_time }}</p>
              <p>订单号：{{ item.trade_no }}</p>
              <!-- <p>供应商：租小奇</p> -->
              <p>订单来源：{{ item.source }}</p>
<!--              <p>-->
<!--                快递信息：-->
                <!-- <span
                  class="blue-font pointer"
                  @click="checkLogistics(item.id)"
                > -->
<!--                {{-->
<!--                  item.logistic.delivery_type == 2-->
<!--                    ? "上门自取"-->
<!--                    : item.logistic.delivery_type == 3-->
<!--                      ? "上门安装"-->
<!--                      : item.logistic.logistics_no-->
<!--                        ? `${item.logistic.logistics_no}(${item.logistic.logistics_name})`-->
<!--                        : "无"-->
<!--                }}-->
                <!-- </span> -->
<!--              </p>-->
<!--              <template v-if="$hasMethod('#changePromoter')">-->
<!--                <p class="color-666 font-12" @click="openPromoter(item)">推广员ID：{{  item.name != null ? item.name :'自然流量' && item.user_promoter_id == null ? '自然流量':'用户分享' && item.user_promoter_id != '' ? '用户分享':'自然流量' }}</p>-->
<!--              </template>-->
<!--              <template v-else>-->
                <p class="color-666 font-12">推广员ID：{{  item.name != null ? item.name :'自然流量' && item.user_promoter_id == null ? '自然流量':'用户分享' && item.user_promoter_id != '' ? '用户分享':'自然流量' }}</p>
<!--              </template>-->
            </div>
            <p>
              <!-- <el-button
                type="primary"
                size="mini"
              >订单设置</el-button> -->
            </p>
          </div>
          <div class="flex item_row">
            <div class="flex" style="width: 27%">
              <el-image
                style="width: 100px; height: 100px"
                :src="item.imgurl ? $globalObj.imgBaseUrl + item.imgurl : ''"
              >
                <div slot="error" class="image-slot">

                </div>
              </el-image>
              <div class="flex-1" style="padding-left: 10px; overflow: hidden">
                <!--text-ellipsis-->
                <p class="title blue-font">
                  {{ item.goods_title }}
<!--                  <i @click="copy1(item.goods_title-->
<!--                  +item.setmeal_title +item.realname+item.address_mobile+-->
<!--                   item.prov + item.city + item.area + item.address)"-->
<!--                     class="el-icon-document-copy"-->
<!--                  ></i>-->
                      </p>

                <p class="meal">套餐信息：{{ item.change_setmeal_title ? item.change_setmeal_title : item.setmeal_title }}
                  <i
                      v-if="$hasMethod('#editDevice')"
                      size="mini"
                      class="el-icon-edit"
                      style="margin-left:5px"
                      @click="editSetmeal(item)"
                  ></i>
                </p>
                <p class="meal">租赁方式：{{ item.pact_type==1 ? '到期买断-随时归还' : '到期买断' }}
                  <i  v-if="$hasMethod('#editDevice') && item.lease_time !=6"
                     class="el-icon-edit" size="mini"
                     @click="editLeaseType(item)"
                  ></i>
                </p>
                <p v-if="item.pact_type!=1" class="meal" >分期：{{ item.month_total==12 ? '6+6' : '3+3' }}
                  <i  v-if="$hasMethod('#editDevice') && item.lease_time !=6"
                      class="el-icon-edit" size="mini"
                      @click="editFenQi(item)"
                  ></i>
                </p>
                <p class="device">
                  设备编号：{{ item.device_number }}
                  <i
                    v-if="$hasMethod('#editDevice')"
                    class="el-icon-edit"
                    size="mini"
                    type="primary"
                    @click="editDevice(item)"
                  ></i>
                </p>
              </div>
            </div>
            <div class="flex flex-center color-666 font-16" style="width: 3%">
              x{{ item.amount }}
            </div>
            <div class="flex flex-column flex-center" style="width: 10%">
              <p class="red-font">
                ￥{{ item.rent_total }}(共{{ item.month_total }}期)
              </p>
              <!-- <p class="color-666">￥{{(item.rent_total/item.month_total).toFixed(2)}}({{item.month_total}}期)</p> -->
              <p style="margin-top: 10px">
<!--                <el-button-->
<!--                  v-if="$hasMethod('#checkLease')"-->
<!--                  size="mini"-->
<!--                  class="border-btn"-->
<!--                  @click="viewLease(item.id)"-->
<!--                >查看租期</el-button>-->
              </p>
              <p style="margin-top: 8px">
<!--                <el-button-->
<!--                    v-if="$hasMethod('#checkFlow')"-->
<!--                    size="mini"-->
<!--                    class="border-btn"-->
<!--                    @click="viewFlow(item.trade_no)"-->
<!--                >流水记录</el-button>-->
              </p>
            </div>
            <div style="width: 9%" class="color-666 font-12 flex flex-center">
              {{ item.begin_time }}至{{ item.end_time }}(共{{
                item.month_total
              }}期)
            </div>
            <div style="width: 8%" class="flex flex-column flex-center">
              <p v-if="item.rights_auth_no" class="red-font">
                ￥{{ item.foregift }}
              </p>
              <p class="color-999 font-12">
                {{
                  !item.rights_auth_no
                    ? "未授权免押"
                    : item.foregift_deduct == 0
                      ? "押金冻结"
                      : item.foregift > 0
                        ? "部分免押"
                        : "押金全免"
                }}
              </p>
              <p
                v-if="item.foregift_deduct > 0"
                class="color-999 font-12"
                style="text-decoration: line-through"
              >
                ￥{{
                  parseFloat(item.foregift) + parseFloat(item.foregift_deduct)
                }}
              </p>
            </div>
            <div style="width: 15%" class="flex flex-column flex-center">
              <p class="red-font">￥{{ item.lease.paid_rent }}</p>
              <p class="color-999 font-12">
                {{
                  item.pay_type == 1
                    ? "智能合同代扣"
                    : item.pay_type == 2
                      ? "芝麻信用（" +
                        (item.rights_auth_no!=0 ? "已授权代扣" : "未授权代扣") +
                        "）"
                      : "花呗"
                }}
              </p>
              <p style="margin-top: 5px" class="color-999 font-12 bold-font">
                <!-- <el-button
                  size="mini"
                  type="success"
                  class="long-text-btn"
                  @click="checkPaidBill(item.id, item.lease.paid_rent)"
                >已付：￥{{ item.lease.paid_rent }}/￥{{
                  item.rent_total
                }}</el-button> -->
                已付：￥{{ item.lease.paid_rent }}/￥{{ item.rent_total }}
              </p>
              <p style="margin-top: 5px" class="color-999 font-12 bold-font">
                <!-- <el-button
                  size="mini"
                  type="warning"
                >已结租金￥{{ item.lease.settle_amount }}</el-button> -->
                已结租金￥{{ Number(item.lease.settle_amount).toFixed(2) }}
              </p>
            </div>
            <div
              style="width:5%;flex-direction: column;"
              class="flex flex-center font-12 color-666"
            ><div>{{ item.is_buy_out==1?'可买断/':'不可买断' }}</div><div>{{ item.setmeal_price+'元' }}</div></div>

            <div style="width: 7%" class="flex flex-column flex-center">
              <template v-if="JSON.stringify(item.lease.next) !== '[]'">
                <p class="font-12 color-666">￥{{ item.lease.next.amount }}</p>
                <p class="font-12 color-666">{{ item.lease.next.date }}</p>
              </template>
            </div>
            <div style="width: 16%;text-align: center">
<!--              <p v-if="$hasMethod('#editAddress')"-->
<!--                  style="text-align: center;font-weight: bold" @click="editAddress(item)">收货地址-->
<!--                <i class="el-icon-edit" size="mini" ></i>-->
<!--              </p>-->
              <p style="text-align: center">
                <span>{{ item.realname }}</span>
<!--                <template v-if="$hasMethod('#phoneNumber')">-->
<!--                  <span>{{ item.address_mobile }}</span>-->
<!--                </template>-->
<!--                <template v-else>-->
                  <span>{{item.address_mobile.slice(0,3)+'****'+item.address_mobile.slice(-4)}}</span>
<!--                </template>-->

              </p>
              <p class="font-12 color-666" style="word-break: break-all">
                {{ item.prov + item.city + item.area + item.address }}
              </p>
<!--              <p style="margin-top: 10px">-->
<!--                <el-button-->
<!--                  v-if="$hasMethod('#editAddress')"-->
<!--                  size="mini"-->
<!--                  class="border-btn"-->
<!--                  @click="editAddress(item)"-->
<!--                >修改地址</el-button>-->
<!--              </p>-->
              <div style="margin-top: 10px">
                <p style="text-align: center"><span style="font-weight: bold">下单手机号
<!--&lt;!&ndash;                  <i v-if="$hasMethod('#placePhone')" class="el-icon-edit"　 @click="openChangePhone(item)"></i>-->
       </span></p>
<!--                <template v-if="$hasMethod('#phoneNumber')">-->
<!--                  <p style="text-align: center">-->
<!--                    {{-->
<!--                      item.mobile-->
<!--                    }}</p>-->
<!--                </template>-->
<!--                <template v-else>-->
                  <p style="text-align: center">
                    {{
                      item.mobile.slice(0,3)+'****'+item.mobile.slice(-4)
                    }}</p>
<!--                </template>-->
              </div>
            </div>
          </div>
          <div class="flex item_row_1">
            <div style="width: 60%" class="detail">
              <p class="color-666">
                认证资料：{{ item.cert_name }}

                （{{ parseFloat(item.cert_no) == 0 ? 0 :  (item.cert_no.slice(0,14)+'****')}})
<!--                <template v-if="$hasMethod('#checkAuthInfo')">-->
<!--                  （{{ item.cert_no }})-->
<!--                </template>-->
<!--                <template v-else>-->
<!--                  （{{ item.cert_no == null ? 0 : item.cert_no.slice(0,3) }})-->
<!--                </template>-->
                ，人脸识别{{
                  item.backResult == 1 ? "通过" : "不通过"
                }}
                性别：{{ item.authentic.sex }} 年龄：{{ item.authentic.age }}
<!--                <template v-if="$hasMethod('#checkAuthInfo')">-->
<!--                  <el-button-->
<!--                      size="mini"-->
<!--                      class="border-btn"-->
<!--                      @click="checkAuthInfo(item)"-->
<!--                  >认证资料</el-button>-->
<!--                </template>-->

<!--                v-if="-->
<!--                item.idcard_back &&-->
<!--                item.idcard_front &&-->
<!--                $hasMethod('#checkAuthInfo')"-->

<!--                <el-button-->
<!--                  size="mini"-->
<!--                  class="border-btn"-->
<!--                  @click="openChangePhone(item)"-->
<!--                >修改手机</el-button>-->
              </p>
<!--              <p class="color-666" style="margin:10px 0" :class="{ 'red-font': item.is_skip == 1 }">-->
<!--                风控信息：-->
<!--                <template>-->
<!--                  <el-select v-model="item.risk_suggestion" clearable-->
<!--                             v-if="$hasMethod('#exportFengkong')"-->
<!--                             @change="selectLetterClick"-->
<!--                             @click.native="partTypesClick(item)"-->
<!--                             placeholder="请选择">-->
<!--                    <el-option-->
<!--                        v-for="items in options"-->
<!--                        :key="items.id"-->
<!--                        :label="items.label"-->
<!--                        :value="items.id">-->
<!--                    </el-option>-->
<!--                  </el-select>-->
<!--                </template>-->
<!--                <span style="margin-right: 10px"></span>-->
<!--                <el-button-->
<!--                    v-if="$hasMethod('#noteMessage')"-->
<!--                 size="mini"-->
<!--                 class="border-btn"-->
<!--                 @click="getRemark(item)">-->
<!--                  备注-->
<!--                </el-button>-->

<!--&lt;!&ndash;                <el-button&ndash;&gt;-->
<!--&lt;!&ndash;                  size="mini"&ndash;&gt;-->
<!--&lt;!&ndash;                  :type="item.isBairong == 1 ? 'primary':'success'"&ndash;&gt;-->
<!--&lt;!&ndash;                  @click="lookBairong(item)"&ndash;&gt;-->
<!--&lt;!&ndash;                >{{ item.isBairong == 1 ? '查询百融数据' : '查看百融报告' }}</el-button>&ndash;&gt;-->
<!--              </p>-->
              <youzupermiss>
                <p class="color-666" style="margin:10px 0">
                  <span style="display:inline-block;width:80px">成色：</span>
                  <template>
                    <el-select
                        v-model="item.phone_fineness"
                        clearable
                        :disabled="true"
                        placeholder="请选择"
<!--                        @change="(value)=>changeChengse(value,item)"-->
                    >
                      <el-option
                          label="全新"
                          value="全新"
                      />
                      <el-option
                          label="二手机"
                          value="二手机"
                      />
                    </el-select>
                  </template>
                </p>
              </youzupermiss>
   <p> 下单地址：{{item.risk}}</p>
            </div>
            <el-dialog title="备注信息" :visible.sync="dialogFormVisible">
              <el-form :model="formNotes" >
                <el-form-item label="信息备注" label-width="200px">
                  <p type="text" v-model="riskId"></p>
<!--                  <p v-model="riskId = item.id"></p>-->
                  <el-input
                      type="textarea" :rows="5" v-model="inputText" style="width: 300px">
                  </el-input>
                </el-form-item>
              </el-form>
              <div slot="footer" class="dialog-footer">
                <el-button @click="dialogFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="riskUpdate">确 定</el-button>
              </div>
            </el-dialog>
            <el-dialog title="设备黑名单" :visible.sync="dialogFormRoll" width="500px">
              <el-form style="text-align: center">
                <el-input type='text' v-model="roll" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')" style="width: 100px;">
                </el-input>
                <span>天数</span>
              </el-form>
              <div slot="footer" class="dialog-footer">
                <el-button @click="dialogFormRoll = false">取 消</el-button>
                <el-button type="primary" @click="Determine">确 定</el-button>
              </div>
            </el-dialog>
            <div style="width: 40%" class="flex flex-column justify-center">
              <p v-if="item.orderRefundReason" style="padding: 0 10px">
                退款原因：{{ item.orderRefundReason }}
              </p>
              <p v-if="item.is_renewal==1" style="margin-left: 10px">
                原订单号：<span class="blue-font">{{ item.parent_order_no }}</span>
              </p>
              <p v-if="item.is_abnormal==1 && [41,42,43,44,45,49,60,65].indexOf(item.status) > -1" class="red-font" style="margin-left: 10px">该订单提前归还</p>
<!--              <p v-if="item.check_refuse_reason && item.status==43" class="red-font" style="margin-left: 10px">审核拒绝原因：{{ item.check_refuse_reason }}</p>-->
<!--              <p class="color-666 font-12" style="margin-bottom: 6px">用户备注：{{ item.remark }}</p>-->
<!--              <p class="color-666 font-12">-->
<!--                客服备注：-->
<!--                <template v-if="JSON.stringify(item.orderRemark) !== '[]'">-->
<!--                  {{ item.orderRemark.create_time }}，{{-->
<!--                    item.orderRemark.username-->
<!--                  }}添加备注：{{ item.orderRemark.remark }}-->
<!--                  <span-->
<!--                    v-if="$hasMethod('#checkRemark')"-->
<!--                    class="blue-font pointer"-->
<!--                    style="margin-right: 10px"-->
<!--                    @click="viewRemark(item.id)"-->
<!--                  >查看备注记录</span>-->
<!--                </template>-->
<!--                <i-->
<!--                  v-if="$hasMethod('#addRemark')"-->
<!--                  size="mini"-->
<!--                  class="el-icon-edit"-->
<!--                  @click="addRemark(item.id)"-->
<!--                ></i>-->
<!--              </p>-->
<!--              <p class="color-666" style="margin-top: 5px">-->
<!--                <template v-if="JSON.stringify(item.leaseFlow) !== '[]'">-->
<!--                  第{{ item.leaseFlow.which_period }}期通过支付宝{{-->
<!--                    item.leaseFlow.pay_type == 1-->
<!--                      ? "智能合同代扣"-->
<!--                      : item.leaseFlow.pay_type == 2-->
<!--                        ? "芝麻信用"-->
<!--                        : item.leaseFlow.pay_type == 3-->
<!--                          ? "花呗"-->
<!--                          : "主动支付"-->
<!--                  }}{{-->
<!--                    item.leaseFlow.status == 1-->
<!--                      ? "支付" + item.leaseFlow.rent + "元"-->
<!--                      : item.leaseFlow.status == 2-->
<!--                        ? "退款" + item.leaseFlow.rent + "元"-->
<!--                        : item.leaseFlow.status == 3-->
<!--                          ? "买断"-->
<!--                          : "未支付"-->
<!--                  }}-->
<!--                </template>-->
<!--              </p>-->
<!--              <p-->
<!--                class="color-666"-->
<!--                style="margin-top:5px"-->
<!--              >-->
<!--                <template>-->
<!--                  总下单数：{{ item.user_order_count }},成交数：{{ item.user_order_success_count }},在租设备：{{ item.user_item_count }},-->
<!--                </template>-->
<!--              </p>-->
            </div>
          </div>
<!--          <div class="flex item_row" style="justify-content: center;">-->
<!--            <p class="btns flex align-center">-->


<!--              <el-button-->
<!--                  v-show="$hasMethod('#checkFengKong') && item.status !=20 && item.status != 60"-->
<!--                size="mini"-->
<!--                  @click="lookFengkong(item)"-->
<!--                  type="success"-->
<!--                 :loading="item.loading">布尔风控-->
<!--              </el-button>-->
<!--&lt;!&ndash;              <el-button&ndash;&gt;-->
<!--&lt;!&ndash;                  v-show="item.status !=20  && item.status != 60 "&ndash;&gt;-->
<!--&lt;!&ndash;                  size="mini"&ndash;&gt;-->
<!--&lt;!&ndash;                  @click="lookTianChuang(item)"&ndash;&gt;-->
<!--&lt;!&ndash;                  type="warning"&ndash;&gt;-->
<!--&lt;!&ndash;                  :loading="item.loading2">天创风控&ndash;&gt;-->
<!--&lt;!&ndash;              </el-button>&ndash;&gt;-->
<!--              <el-button v-show="$hasMethod('#transferOrder') && item.status <= 10 && item.status != 1"-->
<!--                  size="mini"-->
<!--                  @click="zhuanDan(item)"-->
<!--                  type="success">转单-->
<!--              </el-button>-->
<!--              <el-button-->
<!--                  v-show=" $hasMethod('#checkFengKong') && item.status == 20 || item.status == 30 || item.status == 60 || item.status == 39"-->
<!--                  size="mini"-->
<!--                  @click="HlookFengkong(item)"-->
<!--                  type="warning"-->
<!--              >历史风控信息</el-button>-->
<!--              <el-button-->
<!--                  v-if="$hasMethod('#personMessage')"-->
<!--               size="mini"-->
<!--               type="primary"-->
<!--              @click="clientMessges(item)">-->
<!--                客户信息-->
<!--              </el-button>-->
<!--              <el-button-->
<!--                v-if="item.status == 10 && $hasMethod('#delivery')"-->
<!--                size="mini"-->
<!--                type="warning"-->
<!--                @click="openDelivery(item)"-->
<!--              >订单发货</el-button>-->
<!--              <el-button-->
<!--                v-if="item.status == 20 && $hasMethod('#receipt')"-->
<!--                size="mini"-->
<!--                type="warning"-->
<!--                @click="confirmReceipt(item.id)"-->
<!--              >确认收货</el-button>-->
<!--              <el-button-->
<!--                v-if="item.status == 44&&$hasMethod('#confirmR')"-->
<!--                size="mini"-->
<!--                type="warning"-->
<!--                @click="confirmReturn(item.id)"-->
<!--              >确认归还</el-button>-->
<!--              &lt;!&ndash; <el-button-->
<!--                  v-if="item.status == 45"-->
<!--                  size="mini"-->
<!--                  type="warning"-->
<!--                  @click="finishReturn(item.id)"-->
<!--                  >归还完成</el-button> &ndash;&gt;-->
<!--              <el-button-->
<!--                v-if="-->
<!--                  [-->
<!--                    20,30,31,32,33,34,39,40,41,42,43,44,45,49,50,51,52,56,57,58-->
<!--                  ].indexOf(item.status) > -1 && $hasMethod('#checkLogistics')-->
<!--                "-->
<!--                size="mini"-->
<!--                type="primary"-->
<!--                @click="checkLogistics(item.id)"-->
<!--              >查看物流</el-button>-->


<!--              <el-button-->
<!--                v-if="-->
<!--                  [ 3,9,10,11,12,13,14,15,16,20,30,31,32,33,34,39,40,41,42,43,44,45,49,50,51,52,56,57,58,60,61,62,63,64,65]-->
<!--                    .indexOf(item.status) > -1 && item.pact_url != 0 && item.sign_status==2 && $hasMethod('#selectPact')-->
<!--                "-->
<!--                size="mini"-->
<!--                type="primary"-->
<!--                @click="checkPact($globalObj.imgBaseUrl + item.pact_url)"-->
<!--              >查看合同</el-button>-->
<!--              <el-button-->
<!--                v-if="[11, 12, 13, 14].indexOf(item.status) > -1 && $hasMethod('#toDeal')"-->
<!--                size="mini"-->
<!--                type="warning"-->
<!--                @click="handleRefundOrder(item.trade_no)"-->
<!--              >去处理</el-button>-->
<!--              <el-button-->
<!--                v-if="-->
<!--                  [-->
<!--                    9, 10, 11, 12, 13, 14, 20, 30, 31, 32, 33, 34, 39, 40, 41,-->
<!--                    42, 43, 44, 45, 49, 50, 51, 52, 56, 57, 58,-->
<!--                  ].indexOf(item.status) > -1 &&-->
<!--                    item.pay_type == 2 &&-->
<!--                    $hasMethod('#finish')-->
<!--                "-->
<!--                size="mini"-->
<!--                class="border-btn"-->
<!--                @click="finishOrder(item.id)"-->
<!--              >交易完成</el-button>-->
<!--              <el-button-->
<!--                v-if="item.status == 41 && $hasMethod('#agree')"-->
<!--                size="mini"-->
<!--                type="warning"-->
<!--                @click="agreeReturn(item.id)"-->
<!--              >同意归还</el-button>-->
<!--              <el-button-->
<!--                v-if="item.status == 41&& $hasMethod('#refuse')"-->
<!--                size="mini"-->
<!--                type="danger"-->
<!--                @click="refuseReturn(item.id)"-->
<!--              >拒绝归还</el-button>-->
<!--              <el-button-->
<!--                v-if="[2,3,9,10].indexOf(item.status) > -1 && $hasMethod('#close')"-->
<!--                size="mini"-->
<!--                type="danger"-->
<!--                @click="closeOrder(item.id)"-->
<!--              >关闭订单</el-button>-->
<!--              <el-button-->
<!--                v-if="[-->
<!--                  20,30,31,32,33,34,40,41,42,43,44,45,50,51,52,60,61,62,63,64,65-->
<!--                ].indexOf(item.status) > -1 && item.isPolicy == 0 && item.getPolicy == 0 &&  $hasMethod('#insureData') "-->
<!--                size="mini"-->
<!--                type="success"-->
<!--                @click="openPolicy(item.trade_no)"-->
<!--              >投保信息</el-button>-->
<!--              <el-button-->
<!--                v-if="[-->
<!--                  20,30,31,32,33,34,40,41,42,43,44,45,50,51,52,60,61,62,63,64,65-->
<!--                ].indexOf(item.status) > -1 && item.isTWC == 0 && $hasMethod('#antData')"-->
<!--                size="mini"-->
<!--                type="success"-->
<!--                @click="openTWC(item.id)"-->
<!--              >蚂蚁链信息</el-button>-->
<!--              <template v-if="item.roll_status != 1">-->
<!--                <el-button-->
<!--                    v-if="$hasMethod('#blackList')"-->
<!--                    size="mini"-->
<!--                    @click="block(item)"-->
<!--                    type="danger">-->
<!--                  拉黑-->
<!--                </el-button>-->
<!--              </template>-->
<!--              <template v-else>-->
<!--                <el-button-->
<!--                    v-if="$hasMethod('#blackList')"-->
<!--                    size="mini"-->
<!--                    type="info"-->
<!--                    disabled>-->
<!--                  已拉黑-->
<!--                </el-button>-->
<!--              </template>-->
<!--              &lt;!&ndash; <el-button-->
<!--                size="mini"-->
<!--                type="primary"-->
<!--                @click="refreshContract(item)"-->
<!--              >重签合同</el-button> &ndash;&gt;-->

<!--              &lt;!&ndash; <el-button-->
<!--                  size="mini"-->
<!--                  type="primary"-->
<!--                  @click="putLevinwang(item)"-->
<!--                >提交征信查询申请</el-button> &ndash;&gt;-->
<!--              &lt;!&ndash; <el-button-->
<!--                  size="mini"-->
<!--                  type="primary"-->
<!--                  @click="TWCRental(item.trade_no)"-->
<!--                >履约信息</el-button> &ndash;&gt;-->
<!--            </p>-->
<!--          </div>-->
          <!-- <div class="flex item_row">
            <div>蚂蚁链</div>
            <div>
              <el-button
                size="mini"
                type="primary"
                @click="TWCUser(item.trade_no,1)"
              >用户上链</el-button>
              <el-button
                size="mini"
                type="primary"
                @click="TWCOrder(item.trade_no,2)"
              >订单上链</el-button>
              <el-button
                size="mini"
                type="primary"
                @click="TWCOrderProduct(item.trade_no,3)"
              >订单商品上链</el-button> -->
          <!-- <el-button
                size="mini"
                type="primary"
                @click="TWCLogistic(item.trade_no,4)"
              >物流上链</el-button> -->
          <!-- <el-button
                size="mini"
                type="primary"
                @click="TWCLeasePromise(item.trade_no,7)"
              >承诺上链</el-button>
              <el-button
                size="mini"
                type="primary"
                @click="TWCInsurance(item.trade_no,5)"
              >投保</el-button>
              <el-button
                size="mini"
                type="primary"
                @click="TWCInsurance(item.trade_no,8)"
              >退保</el-button> -->
          <!-- <el-button
                size="mini"
                type="primary"
                @click="TWCRental(item.trade_no,6)"
              >履约上链</el-button> -->
          <!-- </div> -->
          <!-- <div>
              <el-button
                size="mini"
                type="primary"
                @click="TWCUser(item.trade_no)"
              >用户信息</el-button>
              <el-button
                size="mini"
                type="primary"
                @click="TWCOrder(item.trade_no)"
              >订单信息</el-button>
              <el-button
                size="mini"
                type="primary"
                @click="TWCOrderProduct(item.trade_no)"
              >订单商品信息</el-button>
              <el-button
                size="mini"
                type="primary"
                @click="TWCLogistic(item.trade_no)"
              >物流信息</el-button>
              <el-button
                size="mini"
                type="primary"
                @click="TWCLeasePromise(item.trade_no)"
              >承诺查询</el-button>
              <el-button
                size="mini"
                type="primary"
                @click="TWCInsurance(item.trade_no)"
              >投保信息</el-button>
              <el-button
                size="mini"
                type="primary"
                @click="TWCRental(item.trade_no)"
              >履约信息</el-button>
            </div> -->
          <!-- </div> -->
        </div>
      </div>
      <custom-page
        ref="customPage"
        :total="total"
        @getList="getList"
      />
    </div>
    <check-lease ref="checkLease" :order-id="selectedId" />
    <set-address
      ref="setAddress"
      :edit-item="editItem"
      @getList="getList"
    />
    <set-device
      ref="setDevice"
      :edit-item="editItem"
      @getList="getList"
    />
    <twc-log
      ref="twcLog"
      :order-id="selectedId"
    />
    <twc-policy
      ref="twcPolicy"
      :order-id="selectedId"
    />
    <set-remark ref="setRemark" :order-id="selectedId" @getList="getList" />
    <check-remark ref="checkRemark" :order-id="selectedId" />
    <check-flow ref="checkFlow" :order-no="selectedId" />
    <delivery
      ref="delivery"
      :order-id="selectedId"
      @getList="getList"
    />
    <receipt ref="receipt" :order-id="selectedId" @getList="getList" />
    <auth-info ref="authInfo" :edit-item="editItem" @getList="getList" />
    <check-bill ref="checkBill" :order-id="selectedId" />
    <check-logistics
      ref="checkLogistics"
      :order-id="selectedId"
    />
    <!-- 拒绝归还 -->
    <el-dialog title="拒绝归还" :visible.sync="returnVisible" width="500px">
      <el-form :model="returnForm">
        <el-form-item label="拒绝原因" label-width="120px">
          <el-input
            v-model="returnForm.checkRefuseReason"
            autocomplete="off"
            placeholder="请输入拒绝原因"
            type="text"
            maxlength="50"
            show-word-limit
          />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="closeReturn">取 消</el-button>
        <el-button type="primary" @click="confirmReturnVisible">确 定</el-button>
      </div>
    </el-dialog>
    <!-- 数据展示 -->
    <el-dialog
      :title="TWCTitle"
      width="600px"
      :visible.sync="isOpenTWC"
    >
      <el-form v-if="Array.isArray(TWCParams)" :model="TWCParams">
        <div v-for="(value1,key1,index1) in TWCParams" :key="index1">
          <el-form-item>数组内容{{ key1 +1 }}</el-form-item>
          <el-form-item v-for="(value,key,index) in value1" :key="index" :label="key" label-width="200px" prop="productId">
            {{ value }}
          </el-form-item>
        </div>
      </el-form>
      <el-form v-else :model="TWCParams">
        <el-form-item v-for="(value,key,index) in TWCParams" :key="index" :label="key" label-width="200px" prop="productId">
          <el-input
            v-model="TWCParams[key]"
            type="text"
            disabled
          />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="isOpenTWC = false">取 消</el-button>
        <el-button type="primary" @click="isOpenTWC = false">确 定</el-button>
      </div>
    </el-dialog>

    <chechUrl-dialog
      ref="chechUrlDialog"
      :select-row="selectRow"
      @getList="getList"
    />
    <chechUrl-dialog1
        ref="chechUrlDialog1"
        :select-row="selectRow"
        @getList="getList"
    />
<!--    <chechUrl-dialog4-->
<!--        ref="chechUrlDialog4"-->
<!--        :day-select="daySelect"-->
<!--        @getList="getList"-->
<!--    />-->
    <chechUrl-dialog3
        ref="chechUrlDialog3"
        :hselect-row="HselectRow"
        :select-phone="selectPhone"
        @getList="getList"
    />
    <chechUrl-dialog2
    ref="chechUrlDialog2"
    :person-message="personMessage"
    @getList="getList"
    />

    <el-dialog
      width="600px"
      title="修改手机号"
      :visible.sync="dialogVisible_phone"
      :close-on-click-modal="false"
    >
      <div>
        <p class="text-center img_header">用户手机号</p>
        <el-input
          v-model="change_mobile"
          placeholder="请输入电话"
          type="text"
          maxlength="50"
        />
      </div>
      <div
        slot="footer"
        class="dialog-footer"
      >
        <el-button
          type="primary"
          @click="changeMemberMobile"
        >修改用户手机号</el-button>
        <el-button
          type="primary"
          @click="dialogVisible_phone=false"
        >关闭</el-button>
      </div>
    </el-dialog>

<!--    转单弹窗-->
<!--    <el-dialog title="转单" :visible.sync="transfer" width="500px">-->
<!--      <el-form-->
<!--          ref="searchForm1"-->
<!--          :inline="true"-->
<!--          :model="searchForm1">-->
<!--        <el-form-item label="选择平台" label-width="120px">-->
<!--          <el-select-->
<!--              v-model="searchForm1.memberId"-->
<!--              placeholder="请选择"-->
<!--              clearable-->
<!--              @change="changeMemberList()"-->
<!--          >-->
<!--            <el-option-->
<!--                v-for="item in memberList"-->
<!--                :key="item.member_id"-->
<!--                :label="item.shopname"-->
<!--                :value="item.member_id"-->
<!--            />-->
<!--          </el-select>-->
<!--        </el-form-item>-->
<!--      </el-form>-->
<!--      <div slot="footer" class="dialog-footer">-->
<!--        <el-button @click="transfer = false">取 消</el-button>-->
<!--        <el-button type="primary" @click="zhuanDanSuccess">确 定</el-button>-->
<!--      </div>-->
<!--    </el-dialog>-->
    <!-- 修改套餐 -->
    <el-dialog title="修改套餐" :visible.sync="setmealVisible" width="500px">
      <el-form :model="returnForm">
        <el-form-item label="选择套餐" label-width="120px">
          <el-select v-model="newSetmeal" placeholder="请选择">
            <el-option
                v-for="item in setmeal"
                :key="item.id"
                :label="item.title"
                :value="item.id"
            />
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="setmealVisible = false">取 消</el-button>
        <el-button type="primary" @click="saveSetmealContact">确 定</el-button>
      </div>
    </el-dialog>
    <!-- 修改租赁方式 -->
    <el-dialog title="修改租赁方式" :visible.sync="leaseTypeVisible" width="500px">
      <el-form :model="returnForm">
        <el-form-item label="选择租赁方式" label-width="120px">
          <el-select v-model="newLeaseType" placeholder="请选择">
            <el-option
                v-for="item in leaseList"
                :key="item.id"
                :label="item.label"
                :value="item.id"
            />
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="leaseTypeVisible = false">取 消</el-button>
        <el-button type="primary" @click="saveleaseType">确 定</el-button>
      </div>
    </el-dialog>
    <!-- 修改分期 -->
    <el-dialog title="修改分期" :visible.sync="instalmentsVisible" width="500px">
      <el-form  :model="returnForm">
        <el-form-item label="选择分期" label-width="120px">
          <el-select v-model="fenqiValue" placeholder="请选择">
            <el-option
                v-for="item in fenqiTpye"
                :key="item.id"
                :label="item.label"
                :value="item.id"
            />
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="instalmentsVisible = false">取 消</el-button>
        <el-button type="primary" @click="saveFenQi">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog
      width="600px"
      title="修改推广员ID"
      :visible.sync="dialogVisible_promoter"
      :close-on-click-modal="false"
    >
      <div>
        <p class="text-center img_header">用户推广员ID</p>
        <el-input
          v-model="change_promoter"
          placeholder="请输入推广员ID"
          type="text"
          maxlength="50"
        />
      </div>
      <div
        slot="footer"
        class="dialog-footer"
      >
        <el-button
          type="primary"
          @click="changePromoter"
        >修改推广员ID</el-button>
        <el-button
          type="primary"
          @click="dialogVisible_promoter=false"
        >关闭</el-button>
      </div>
    </el-dialog>
  </div>

<!--  </div>-->
</template>
<script>
import { changeMemberMobile,memberCount,setPhoneFineness } from '@/api/order'
import { checkRiskCredit, Levinwang,checkSirius,tcredit } from '@/api/data'
import globalData from '../../utils/global'
import customPage from '@/components/customPage'
import myDatePicker from '@/components/myDatePicker'
import chechUrlDialog from '@/components/chechUrl'
import chechUrlDialog1 from '@/components/chechUrl1'
import chechUrlDialog3 from '@/components/chechUrl2'
import chechUrlDialog2 from '@/components/chechPerson'
import {
  orderList,
  getOrderStatus,
  getShopType,
  orderListExport,
  orderFinish,
  orderReturnAgree,
  orderReturnRefuse,
  orderComfirmReturn,
  orderReturnFinish,
  handCreateContract,
  orderClose,
  changePromoter,
  changeSetmeal,
  getGoodsSetmealList,
  customerInformation,
  riskUpdate,
  replacePackage,
  riskFknote,
  rollMobile,
  selectFkMessage,
  replaceFenQi,
  promoterOrderExport
} from '@/api/order'
import checkLease from './dialogs/checklease'
import setAddress from './dialogs/setAddress'
import setDevice from './dialogs/setDevice'
import setRemark from './dialogs/setRemark'
import checkRemark from './dialogs/checkRemark'
import checkFlow from './dialogs/checkFlow'
import delivery from './dialogs/delivery'
import receipt from './dialogs/receipt'
import authInfo from './dialogs/authInfo'
import checkBill from './dialogs/checkBill'
import checkLogistics from './dialogs/checkLogistics'
import twcLog from './dialogs/twcLog'
import twcPolicy from './dialogs/twcPolicy'
import {getMemberList} from '@/api/system'
import {orderTransfer} from '@/api/order'
import { twcUserGet, twcGetOrderGet, twcGetOrderProductGet, twcGetLogisticGet, twcLeasePromiseGet, twcRentalGet, twcInsuranceGet, alipayTWCSm } from '@/api/aliPayTWC'
export default {
  components: {
    myDatePicker,
    customPage,
    checkLease,
    setAddress,
    setDevice,
    setRemark,
    checkRemark,
    checkFlow,
    delivery,
    receipt,
    authInfo,
    checkBill,
    checkLogistics,
    twcLog,
    twcPolicy,
    chechUrlDialog,
    chechUrlDialog1,
    chechUrlDialog2,
    chechUrlDialog3
  },
  data() {
    return {
      options:[
          {
        id: 1,
        label: '[优]风控通过，建议发货（该类用户建议发货率80%以上)'
      }, {
        id: 2,
        label: '[良]建议适当预收客户租金，正常电审（建议发货率30%以上)'
      }, {
        id: 3,
        label: '[一般]中高风险，建议电审，如 1.通过核实用户的工作情况和累计贷款金额等，判断偿还能力；2.核实常驻地址；3.增加紧急联系人（该类用户发货率不做要求)'
      }, {
        id: 4,
        label: '[差]风控不通过，建议关闭订单'
      }, {
        id: 5,
        label: '无需输出风控'
        }
      ],
      valuesSuggest:'',
      formNotes:{

      },
      btnLoading:false,
      changeLockedLoading:false,
      roll:'',
      inputText:'',
      dialogFormVisible: false,
      dialogFormVisible1: false,

      dialogFormRoll:false,
      searchForm: {
        mobile: '',
        userId: null,
        type: null,
        status: null,
        orderNo: '',
        goodsName: '',
        receivingName: '',
        receivingMobile: '',
        riskName: '',
        riskMobile: '',
        orderStatus: '',
        shoptypes:'',
        orderCreateTime: '',
        shopName: '',
        promoter_id: '',
        userIds: ''
      },
      fenqiValue:'',
     searchForm1:{
       memberId:''
     },
      memberList:[],
      memberCountList:[],
      supplierName:'',
      statusList: globalData.orderStatus,
      total: 0,
      tableData: [],
      riskId:'',
      activeName: 'all',
      tabList: [
        {
          id: 'all',
          name: '全部订单',
          count: 0
        },
        {
          id: 'notPay',
          name: '待付款订单',
          count: 0
        },
        {
          id: 'notRisk',
          name: '待风控订单',
          count: 0
        },
        {
          id: 'deliveredNot',
          name: '待审核订单',
          count: 0
        },
        {
          id: 'Signed',
          name: '已签署',
          count: 0
        },
        {
          id: 'deliveredIs',
          name: '已发货订单',
          count: 0
        },
        {
          id: 'orderIng',
          name: '租用中订单',
          count: 0
        },
        {
          id: 'orderCompleted',
          name: '交易完成订单',
          count: 0
        },
        {
          id: 'orderCancel',
          name: '取消订单',
          count: 0
        },
        {
          id: 'orderReturn',
          name: '归还订单',
          count: 0
        },
        {
          id: 'orderBuyout',
          name: '买断订单',
          count: 0
        },
        {
          id: 'orderRenewal',
          name: '续租订单',
          count: 0
        },
        {
          id: 'orderApplyRefund',
          name: '申请退款',
          count: 0
        },
        {
          id: 'orderRefund',
          name: '退款订单',
          count: 0
        }
      ],
      orderId:'',
      selectedId: '',
      editItem: {},
      selectList: [],
      selectType:[],
      returnVisible: false,
      refuseId: '',
      //修改套餐
      setmealVisible:false,
      leaseTypeVisible:false,
      instalmentsVisible:false,
      setmeal:[],
      leaseList:[
          { id: 1, label: '到期买断-随时归还'},
        { id: 2, label: '到期买断'},
      ],

      fenqiTpye:[
        { id: 1,label: '6+6期'}
        ,{ id: 2,label: '3+3期'}
      ],
      newSetmeal:'',
      newLeaseType:'',
      returnForm: {
        checkRefuseReason: ''
      },
      instalmentsForm:{
        orderId: '',
         fenqi:''
      },
      setmealForm: {
        setmealId: '',
        orderId: ''
      },
      leaseForm: {
        orderId: '',
        pact_type: ''
      },
      //转单
      transfer: false,

      isOpenTWC: false,
      TWCTitle: '',
      TWCParams: {},

      isHashBairong: false,
      selectRow: null,

      HselectRow:null,
      daySelect:null,
      selectPhone:null,
      personMessage: null,

      riskMessage:null,
      dialogVisible_phone: false,
      change_mobile: '',

      dialogVisible_promoter: false,
      change_promoter: ''
    }
  },
  mounted() {
    if (this.$route.params.orderId) {
      this.searchForm.orderNo = this.$route.params.orderId
    }
    if (this.$route.params.userIds) {
      this.searchForm.userIds = this.$route.params.userIds
    }
    this.getSelect()
    // this.getSelectType()
    this.getList()
    // this.getSelectTerrace()
    // this.getMemberCount()
  },
  methods: {
    getMemberCount(){
      memberCount({
      }).then((res) => {

        this.memberCountList = res.data

      })
    },
    partTypesClick(item){

      this.riskId = item.id;
      // console.log(item.id);
    },
    changeChengse(value,item){
      setPhoneFineness({
        orderId: item.id,
        phone_fineness:value
      }).then(()=>{
        this.$message.success('修改成色成功')
      })
    },
    selectLetterClick(value){
      this.valuesSuggest = value;
      let data = {};
      if (this.valuesSuggest != 4){
        data.value=this.valuesSuggest;
        data.orderId = this.riskId;
        riskFknote(data).then((res)=>{
          if (res!=null){
            this.$message.success('风控输出完成');
          }else {
            this.$message('备注失败');
          }
        })
      }else {
        let data = {};
        // data.value=this.valuesSuggest;
        data.orderId = this.riskId;
        // console.log(data);
        this.$confirm('是否关闭订单?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
        }).then(() => {
          orderClose(data).then((res)=>{
              riskFknote({orderId:this.riskId,value:this.valuesSuggest}).then(res=>{
                this.getList();
              })


            // if (res!=null){
            //   this.$message.success('关闭成功');
            //   this.getList();
            // }else {
            //   this.$message('关闭失败');
            // }

          })

          })
      };



    },

    block(item){
      this.dialogFormRoll = true;
      this.riskId = item.id;

    },
    Determine(){

      if (this.roll > 999){
        this.$message.warning('天数不能大于999')
        return false;
      }else {
        let data={};
        data.days=this.roll;
        data.orderId=this.riskId;
        rollMobile(data).then((res=>{
          if (res!=null){
            this.dialogFormRoll = false;
            this.$message.success('拉黑成功');
            this.getList();

          }else {
            this.$message.warning('拉黑失败')
            return false;
          }

        }));
      }



    },
    getRemark(item){
      this.inputText = ''
       this.dialogFormVisible = true;
       this.riskId = item.id;
       this.inputText = item.risk_note;
    },

    // 打开修改推广员id界面
    openPromoter(item) {
      this.selectRow = item
      this.dialogVisible_promoter = true
    },

    changeMemberList(){
      let obj = ''
      obj = this.memberList.find((item) => {
        return item.member_id === this.searchForm1.memberId;
      });
     this.supplierName = obj.shopname
    },
    // 修改推广员id
    changePromoter() {
      this.$confirm(
        '确定要修改推广员ID为 ' + this.change_promoter + ' 吗？', '请确认是否修改推广员ID？', {
          confirmButtonText: '确定',
          cancelButtonText: '取消'
        }).then(() => {
        changePromoter({ 'order_id': this.selectRow.id, 'promoter_id': this.change_promoter }).then((res) => {
          this.dialogVisible_promoter = false
          this.getList()
        })
      }).catch(() => {})
    },


    // selectLetter(e){
    //   let s = this;
    //   console.log(s);
    // },
    //风控备注信息
    riskUpdate(item){
      // let orderId = item.id;
      let row={}
       row.riskSuggest = this.valuesSuggest
       row.riskNote = this.inputText;
        row.id = this.riskId

      if (row.riskSuggest !=null || row.riskNote!=null){
        riskUpdate(row).then(res =>{
          this.dialogFormVisible = false;
          this.$message.success('备注成功');
          this.getList(true);
        })
      }else {
        this.$message({
          message: "备注信息不能全部为空",
          type: "error"
        });
        return false;
      }

    },
    // 重签合同
    refreshContract(item) {
      this.$confirm(
        '发起重签将会丢失原合同，且已上联合同无法修改，请慎重重签！', '请确认是否重签合同？', {
          confirmButtonText: '确定',
          cancelButtonText: '取消'
        }).then(() => {
        handCreateContract({ 'order_id': item.id }).then((res) => {
          // this.getList()
        })
      }).catch(() => {})
    },
    openChangePhone(row) {
      this.selectRow = row
      this.change_mobile = row.address_mobile
      this.dialogVisible_phone = true
    },
    changeMemberMobile() {
      const data = {
        order_uid: this.selectRow.uid,
        member_mobile: this.change_mobile
      }
      changeMemberMobile(data).then(
        res => {
          this.$message.success('修改成功')
          this.getList()
          this.dialogVisible_phone = false
        }
      )
    },
    // 征信
    putLevinwang(row) {
      Levinwang({ order_id: row.id }).then(res => {
        this.$message.success(res.msg)
      })
    },
    // 百荣
    lookBairong(row) {
      this.selectRow = row
      this.selectRow.order_id = row.id
      // 未进行百融
      if (row.isBairong == 1) {
        checkRiskCredit({ order_id: row.id }).then(res => {
          this.$refs.chechUrlDialog.dialogVisible = true
        })
      } else {
        this.$refs.chechUrlDialog.dialogVisible = true
      }
    },
    //风控
   lookFengkong(row) {
      this.selectRow = row
      this.selectRow.order_id = row.id
      row.loading = true;
      // this.btnLoading =true;
      // this.changeLockedLoading = true;
      // 未进行风控
      if (!(row.cert_name == "0" || row.cert_no== "0" || row.address_mobile== "0")){

        checkSirius({ order_id: row.id }).then(res => {
          // this.btnLoading = false;
          this.$refs.chechUrlDialog1.dialogVisible = true
          row.loading = false;
        })

      }else {
        row.loading = false;
        this.$message.warning('请联系客户完成实名认证')
        return false;
        // this.btnLoading = false;
      }
    },
    //历史风控
    HlookFengkong(row){
      this.HselectRow = {};
      this.selectPhone={};
      this.selectPhone=row;
      // this.HselectRow = row;
      // this.$refs.chechUrlDialog3.dialogVisible = true
    if (row.id != null){
      selectFkMessage({orderId:row.id}).then(res=>{
        if (res.length!=0){
          this.HselectRow = res;
          this.$refs.chechUrlDialog3.dialogVisible = true
        }
      })
    }

    },
    //天创风控
    // lookTianChuang(item){
    //     this.daySelect=item;
    //     item.loading2=true;
    //   // this.$refs.chechUrlDialog4.dialogVisible=true
    //   if (!(item.cert_name == "0" || item.cert_no== "0" || item.address_mobile== "0")){
    //     tcredit({order_id:item.id}).then(res=>{
    //       checkSirius({ order_id: item.id }).then(res => {
    //         // this.btnLoading = false;
    //         // this.$refs.chechUrlDialog1.dialogVisible = true
    //         this.$refs.chechUrlDialog4.dialogVisible=true
    //         item.loading2=false;
    //       })
    //
    //
    //     })
    //
    //   }else {
    //     item.loading2 = false;
    //     this.$message.warning('请联系客户完成实名认证')
    //     return false;
    //   }
    // },
    //获取客户备注信息
    clientMessges(item){

      let param = {};
      param.orderId = item.id;
      this.personMessage = {}
      customerInformation(param).then(res=>{
        if (res.length!=0){
          this.personMessage = res;
          this.$refs.chechUrlDialog2.dialogVisible = true
        }else {
          this.personMessage.oid = item.id;
          this.$refs.chechUrlDialog2.dialogVisible = true
        }
          },
      )
      // console.log(item)
    },
    // 更改套餐
    editSetmeal(item) {
      this.setmealVisible = true
      this.setmealForm.orderId = item.id
      getGoodsSetmealList(item.goods_id).then(res => {
        this.setmeal = res.setmeal
      })
    },
    editLeaseType(item){
      this.leaseTypeVisible = true
      this.newLeaseType = item.pact_type
      this.leaseForm = {
        orderId: item.id,
      }
    },
    editFenQi(item){
      this.instalmentsVisible = true
      this.fenqiValue = item.month_total==12 ? 1 : 2
      this.newLeaseType = item.pact_type
      this.instalmentsForm = {
        orderId: item.id,
        pact_type: this.newLeaseType,
      }
    },
    saveFenQi(){
      this.instalmentsVisible = false
      this.instalmentsForm.fenqi = this.fenqiValue
      replaceFenQi(this.instalmentsForm).then(res => {
        this.$message.success('修改成功')
        this.getList()
      })
    },
    saveSetmealContact() {
      this.setmealVisible = false
      this.setmealForm.setmealId = this.newSetmeal
      changeSetmeal(this.setmealForm).then(res => {
        this.$message.success('修改成功')
        this.getList()
      })
    },
    saveleaseType(){
      this.leaseTypeVisible = false
      this.leaseForm.pact_type = this.newLeaseType
      replacePackage(this.leaseForm).then(res => {
        this.$message.success('修改成功')
        this.getList()
      })
    },
    // 转单
    zhuanDan(item){
      this.searchForm1={}
      this.transfer = true
      this.orderId = item.id;
    },
    //转单确定按钮事件
      zhuanDanSuccess(){
     this.$refs['searchForm1'].validate((valid)=>{

             if (valid) {

              let param = {};
              param.member_id = this.searchForm1.memberId;
              param.order_id = this.orderId;
           orderTransfer(param).then( res =>{

                     this.$message.success('转单成功')
                     this.tableData.forEach(val => {
                       if(val.id == this.orderId){
                          val.shopname = this.supplierName
                       };
                     });
                     this.transfer = false;

                  }
              )
             } else {
               console.log('error submit!!');
               return false;
             }


    })
    },

    openTWC(id) {
      this.selectedId = id
      this.$refs.twcLog.dialogVisible = true
    },
    // 打开保单界面
    openPolicy(id) {
      this.selectedId = id
      this.$refs.twcPolicy.dialogVisible = true
    },
    // 蚂蚁链用户查询
    TWCUser(id, type = 0) {
      if (type == 0) {
        twcUserGet({ orderId: id }).then(res => {
          this.TWCParams = JSON.parse(res.data.response_data)
          this.isOpenTWC = true
          console.log(res)
        })
      } else {
        alipayTWCSm({ trade_no: id, type: type }).then(res => {
          console.log(res)
        })
      }
    },
    // 蚂蚁链订单查询
    TWCOrder(id, type = 0) {
      if (type == 0) {
        twcGetOrderGet({ orderId: id }).then(res => {
          this.TWCParams = JSON.parse(res.data.response_data)
          this.isOpenTWC = true
          console.log(res)
        })
      } else {
        alipayTWCSm({ trade_no: id, type: type }).then(res => {
          console.log(res)
        })
      }
    },
    // 蚂蚁链订单商品查询
    TWCOrderProduct(id, type = 0) {
      if (type == 0) {
        twcGetOrderProductGet({ orderId: id }).then(res => {
          this.TWCParams = JSON.parse(res.data.response_data)
          this.isOpenTWC = true
          console.log(res)
        })
      } else {
        alipayTWCSm({ trade_no: id, type: type }).then(res => {
          console.log(res)
        })
      }
    },
    // 蚂蚁链物流查询
    TWCLogistic(id, type = 0) {
      if (type == 0) {
        twcGetLogisticGet({ orderId: id }).then(res => {
          this.TWCParams = JSON.parse(res.data.response_data)
          this.isOpenTWC = true
          console.log(res)
        })
      } else {
        alipayTWCSm({ trade_no: id, type: type }).then(res => {
          console.log(res)
        })
      }
    },
    // 蚂蚁链投保查询
    TWCInsurance(id, type = 0) {
      if (type == 0) {
        twcInsuranceGet({ orderId: id }).then(res => {
          this.TWCParams = JSON.parse(res.data.response_data)
          this.isOpenTWC = true
          console.log(res)
        })
      } else {
        alipayTWCSm({ trade_no: id, type: type }).then(res => {
          console.log(res)
        })
      }
    },
    // 蚂蚁链承诺查询
    TWCLeasePromise(id, type = 0) {
      if (type == 0) {
        twcLeasePromiseGet({ orderId: id }).then(res => {
          this.TWCParams = JSON.parse(res.data.response_data)
          this.isOpenTWC = true
          console.log(res)
        })
      } else {
        alipayTWCSm({ trade_no: id, type: type }).then(res => {
          console.log(res)
        })
      }
    },
    // 蚂蚁链用户上链/查询
    TWCRental(id, type = 0) {
      if (type == 0) {
        twcRentalGet({ orderId: id }).then(res => {
          this.TWCParams = JSON.parse(res.data.response_data)
          this.isOpenTWC = true
          console.log(res)
        })
      } else {
        alipayTWCSm({ trade_no: id, type: type }).then(res => {
          console.log(res)
        })
      }
    },
    handleRefundOrder(tradeNo) {
      this.$router.push({ name: 'refundList', params: { tradeNo }})
    },
    // 查看合同
    checkPact(url) {
      window.open(url)
    },
    // 订单完结
    finishOrder(id) {
      this.$confirm(
        '交易完成后进行解约现有款项不退款，并解约代扣无法发起未代扣的期数！', '请确认是否交易完成？', {
          confirmButtonText: '确定',
          cancelButtonText: '取消'
        }).then(() => {
        orderFinish(id).then((res) => {
          this.getList()
        })
      }).catch(() => {})
    },
    // 同意归还
    agreeReturn(id) {
      this.$confirm('确定要同意归还吗？', '同意归还', {
        confirmButtonText: '确定',
        cancelButtonText: '取消'
      }).then(() => {
        orderReturnAgree(id).then((res) => {
          this.getList()
        })
      }).catch(() => {})
    },
    // 拒绝归还
    refuseReturn(id) {
      this.refuseId = id
      this.returnVisible = true
    },
    // 订单关闭
    closeOrder(id) {
      this.$confirm('确定要关闭订单吗？', '关闭', {
        confirmButtonText: '确定',
        cancelButtonText: '取消'
      }).then(() => {
        orderClose(id).then(res => {
          this.getList()
        })
      }).catch(() => {})
    },
    closeReturn() {
      this.returnVisible = false
      this.returnForm.checkRefuseReason = ''
    },
    confirmReturnVisible() {
      if (!this.returnForm.checkRefuseReason) {
        this.$message.warning('拒绝原因不能为空')
        return false
      }
      orderReturnRefuse({
        orderId: this.refuseId,
        checkRefuseReason: this.returnForm.checkRefuseReason
      }).then((res) => {
        this.getList()
        this.closeReturn()
      }).catch(() => {})
    },
    // 确认归还
    confirmReturn(id) {
      this.$confirm('确定要归还吗？', '确认归还', {
        confirmButtonText: '确定',
        cancelButtonText: '取消'
      }).then(() => {
        orderComfirmReturn(id).then((res) => {
          this.getList()
        })
      }).catch(() => {})
    },
    // 归还完成
    // finishReturn(id) {
    //   orderReturnFinish(id).then((res) => {
    //     this.getList();
    //   });
    // },
    // 查看物流
    checkLogistics(id) {
      this.selectedId = id
      this.$refs.checkLogistics.dialogVisible = true
    },
    // 查看已付账单详情
    checkPaidBill(id, paid_rent) {
      if (this.$hasMethod('#checkBill') && paid_rent > 0) {
        this.selectedId = id
        this.$refs.checkBill.dialogVisible = true
      }
    },
    // 查看认证资料
    checkAuthInfo(item) {
      console.log(item);
      this.editItem = {
        idcard_back: item.idcard_back,
        idcard_front: item.idcard_front,
        address_mobile: item.mobile,
        uid: item.uid,
        formname:item.cert_name,
        idNumber:item.cert_no

      }
      this.$refs.authInfo.dialogVisible = true
    },
    // 确认收货
    confirmReceipt(id) {
      this.selectedId = id
      this.$refs.receipt.dialogVisible = true
    },
    // 订单发货
    openDelivery(item) {
      this.selectedId = item;
      this.$refs.delivery.dialogVisible = true
    },
    // 查看流水记录
    viewFlow(trade_no) {
      this.selectedId = trade_no
      this.$refs.checkFlow.dialogVisible = true
    },
    // 查看客服备注
    viewRemark(id) {
      this.selectedId = id
      this.$refs.checkRemark.dialogVisible = true
    },
    // 添加客服备注
    addRemark(id) {
      this.selectedId = id
      this.$refs.setRemark.dialogVisible = true
    },
    // 更改设备编号
    editDevice(item) {
      this.editItem = {
        orderId: item.id,
        deviceNumber: item.device_number ? item.device_number.split(',') : [],
        amount: item.amount
      }
      this.$refs.setDevice.dialogVisible = true
    },

    // 修改地址
    editAddress(item) {
      this.editItem = {
        orderId: item.id,
        realname: item.realname,
        mobile: item.address_mobile,
        address: item.address,
        prov: item.prov,
        city: item.city,
        area: item.area,
        province: [item.prov, item.city, item.area]
      }
      this.$refs.setAddress.dialogVisible = true
    },
    // 查看租期
    viewLease(id) {
      this.selectedId = id
      this.$refs.checkLease.dialogVisible = true
    },
    getOrderStatusType(status) {
      const obj = this.statusList.find((item) => item.id == status)
      return obj ? obj.type : 'warning'
    },
    getOrderStatusName(status) {
      const obj = this.statusList.find((item) => item.id == status)
      return obj ? obj.name : ''
    },
    // 获取数据
    getList(flag) {
      // flag为true, 则不刷新表格
      const { page, pageSize } = this.$refs.customPage
      if (!flag) {
        this.tableData = []
      }

      orderList({
        page,
        pageSize,
        ...this.searchForm,
        orderStatusGroup: this.activeName
      }).then((res) => {


        const { list, count } = res
        this.tableData = list.data || []
        this.total = list.total || 0
        for (const item of this.tabList) {
          //订单数量
          item.count = count[item.id]
        }
      })
    },
    // 查询
    search() {
      const pickerVal = this.$refs.myDatePicker.getVal()
      if (pickerVal !== 'error') {
        this.searchForm.orderCreateTime = pickerVal
        this.$refs.customPage.page = 1
        this.getList()
      }
    },
    //复制商品名称||套餐信息||收货人信息
    copy1(data){
      let url = data;
      let oInput = document.createElement('input');
      oInput.value = url;
      document.body.appendChild(oInput);
      oInput.select(); // 选择对象;
      console.log(oInput.value)
      document.execCommand("Copy"); // 执行浏览器复制命令
      this.$message({
        message: '复制成功',
        type: 'success'
      });
      oInput.remove()
    },

    // 重置
    reset() {
      if (this.$refs.myDatePicker) {
        this.$refs.myDatePicker.reset()
      }
      this.searchForm = {
        orderNo: '',
        goodsName: '',
        receivingName: '',
        receivingMobile: '',
        riskName: '',
        riskMobile: '',
        orderStatus: '',
        shoptypes: '',
        orderCreateTime: '',
        shopName: '',
        userIds: ''
      }
      this.getList()
    },
    // 导出
    exportFile1() {
      const pickerVal = this.$refs.myDatePicker.getVal()
      if (pickerVal !== 'error') {
        this.searchForm.orderCreateTime = pickerVal
        promoterOrderExport({
          ...this.searchForm,
          orderStatusGroup: this.activeName
        })
      }
    },
    handleClick(tab) {
      this.activeName = tab.name
      this.$refs.customPage.page = 1
      this.getList()
    },
    getSelectTerrace(){
      getMemberList().then(res => {
        this.memberList = res || []
      })
    },
    getSelect() {
      getOrderStatus().then((res) => {
        const list = []
        for (const key in res) {
          list.push({
            id: key,
            name: res[key]
          })
        }
        this.selectList = list || []
      })
    },
    getSelectType(){
      getShopType().then((res) => {
        const list = []
        for (const key in res) {
          list.push({
            id: key,
            name: res[key]
          })
        }
        this.selectType = list || []
      })
    }

  }
}
</script>
<style lang="scss" scoped>
.common_form_search {
  padding: 15px 30px 0;
}
.child_page {
  padding-bottom: 15px;
  padding-left: 30px;
  padding-right: 30px;
  p,
  div {
    box-sizing: border-box;
  }
}
.list_wrap {
  position: relative;
}
.list_header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  min-height: 50px;
  z-index: 2;
  background: #f5f5f5;
  border: 1px solid #e6e6e6;
  p {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
  }
  p:not(:first-child) {
    border-left: 1px solid #e6e6e6;
  }
}
.list_item {
  border: 1px solid #e6e6e6;
  margin-top: 10px;
}
.item_row {
  border-top: 1px solid #e6e6e6;
  & > div {
    padding: 10px;
    color: #666666;
    &:not(:first-child) {
      border-left: 1px solid #e6e6e6;
    }
  }
}
.item_row_1 {
  border-top: 1px solid #e6e6e6;
  & > div {
    padding: 10px;
    color: #666666;
    &:not(:first-child) {
      // border-left: 1px solid #e6e6e6;
    }
  }
}
.detail,
.btns {
  padding: 10px;
}
.btns {
  // border-left: 1px solid #e6e6e6;
  .el-button + .el-button {
    margin-left: 10px;
  }
}
.border-btn {
  height: 25px;
  padding-top: 0;
  padding-bottom: 0;
  background: #ffffff;
  border: 1px solid $mainBlue;
  border-radius: 3px;
  color: $mainBlue;
  font-size: 12px;
}
.sign_icons img {
  width: 21px;
  height: 23px;
  margin-right: 2px;
}
.item_header {
  padding: 5px 10px;
  background-color: #f5f5f5;
  & > div p {
    color: #666666;
    font-size: 12px;
    padding-left: 20px;
  }
}
.title {
  font-size: 16px;
  line-height: 23px;
  padding-bottom: 15px;
}
.meal,
.device {
  font-size: 12px;
  color: #999999;
  line-height: 23px;
}
.item_row p {
  line-height: 23px;
}
.item_row div {
  line-height: 20px;
}
</style>
